﻿@model System.Int32
@{
    ViewBag.Title = "Modal image uploader";
}

<script type="text/javascript">
    $(document).ready(function () {
        $('.modal_block').click(function (e) {
            $('#tn_select').empty();
            $('.modal_part').hide();
        });
        $('#modal_link').click(function (e) {
            $('.modal_part').show();
            var context = $('#tn_select').load('@(Url.Action("UploadImage"))?entityID=@Model', function () {
                initSelect(context);
            });
            e.preventDefault();
            return false;
        });
    });
</script>

<div class="modal_block modal_part"></div>
<div class="modal_dialog modal_part" id="tn_select"></div>

<p>
    <a href="#" id="modal_link">Click here to upload image.</a>
</p>